package review;

public class final_ {
    public static void main(String[] args) {

        final Person person=new Person("wangyi");
        System.out.println(person.hashCode());
        person.name="1234";
        System.out.println(person.hashCode());

        /**
         *  报错：Cannot assign a value to final variable 'person' */
//        person=new Person("333");
        System.out.println(person.hashCode());

        System.out.println("------------------");
        Animal animal=new Animal("niu");
        System.out.println(animal.hashCode());
        animal.type="ma";
        System.out.println(animal.hashCode());

        animal=new Animal("ma");
        System.out.println(animal.hashCode());
    }
}

final class Person{
    String name;

    public Person(String name) {
        this.name = name;
    }
}


class Animal{
    String type;

    public Animal(String type) {
        this.type = type;
    }
}

interface MainInterface{
    int nNum = 0;
    public static void main(String[] args) {
        System.out.println("接口");
    }
    default void setData(int num){

    }
    void getData();
}